
<template>
  <div id="main">
    <div>
      <van-nav-bar title="设置" right-text="···" left-arrow @click-left="onClickLeft" />
    </div>
    <div>
      <span>我的设备</span>
    </div>
    <div class="my_tilist">
      <div class="my_tilist1">
        今日
      </div>
      <div class="my_tilist1">
        按周
      </div>
      <div class="my_tilist1">
        按月
      </div>
      <div class="my_tilist1">
        按年
      </div>
    </div>
    <div class="my_price">
      <div>
        <p>昨日</p>
        <span>19.89元</span>
      </div>
      <div>
        <p>今日</p>
        <span>16.33元</span>
      </div>
    </div>
    <div>
      <div ref="barChart" :style="{ width: '110x', height: '250px' }"></div>
    </div>
    <div class="my_price">
      <div>
        <p>功率</p>
        <span>1.9KW</span>
      </div>
      <div>
        <p>气流</p>
        <span>120M3</span>
      </div>
    </div>
    <div class="my_imgbox">
      <div>
        <div>
          <img src="../../../../public/image/roomimg/room (2).png" alt="" class="mying">
        </div>
      </div>
      <div>
        <div>
          <img src="../../../../public/image/roomimg/room (7).png" alt="" class="mying">
        </div>
      </div>

    </div>
  </div>
</template>
<script setup lang="ts">

import router from '@/router';
import * as echarts from 'echarts';
import { onMounted, ref } from 'vue';
// import { ref } from 'vue';

const onClickLeft = () => {
  router.push('./entrance')
}


const barChart = ref<HTMLElement>();
const myChart1 = ref<any>();
// 绘制柱形图
function initBarEcharts() {
  myChart1.value = echarts.init(barChart.value!);
  myChart1.value.setOption({
    title: {

      x: 'center'
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {

      orient: 'vertical',
      right: 60,
      top: 20
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      show: false
    },
    yAxis: {
      type: 'value',
      show: false
    },
    color: ['#c38bef', '#6dbcf7'],
    series: [
      {
        smooth: true,
        data: [20, 50, 80, 30, 150, 50, 280],
        type: 'line',
        areaStyle: {}
      }
    ],
    grid: {
      x: 0,
      y: 45,
      x2: 0,
      y2: 20,
      borderWidth: 1
    }
  });
}
onMounted(() => {
  initBarEcharts();
});


</script>
<style scoped lang="scss">
#main {
  padding: 1rem;
}

.my_tilist {
  display: flex;
  justify-content: space-around;

  .my_tilist1 {
    width: 6.8rem;
    height: 3.2rem;
    margin-top: 1rem;
    border-radius: 3rem;
    color: #352C5D;
    text-align: center;
    line-height: 3rem;
  }

  .my_tilist1:hover {
    color: white;
    background-color: #352C5D;
  }
}

.my_price {
  display: flex;
  justify-content: space-between;
}

.my_imgbox {
  display: flex;
  justify-content: space-around;
  align-items: center;

  .mying {
    height: 18rem;
  }
}
</style>